package com.coscon.controller;


import com.coscon.controller.base.BaseController;
import com.coscon.model.auth.LeftMenu;
import com.coscon.service.CoreAuthService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 共用，登录后，每个账号都可以访问
 */
@Controller
@RequestMapping("/jm/manager/common/")
public class LeftMenuController extends BaseController {

    @Resource
    private CoreAuthService coreAuthService;

    /*        *
     *根据userId获取左侧导航菜单
     * @author 409390047@qq.com
     * @date 2021/6/14
     * @param [request, userId]
     */
    @RequestMapping(value = "/index/getLeftNavigationMenuListByUserId")
    public @ResponseBody
    List<LeftMenu> getLeftNavigationMenuListByUserId(
            HttpServletRequest request,
            @RequestParam(value = "userId", required = false) String userId
    ) {
        String contextPath = request.getContextPath();
        return coreAuthService.getLeftNavigationMenuListByUserId(userId, contextPath);
    }





}
